<!DOCTYPE HTML>

<head>
    <title>订单详情</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <!-- jquery -->
    <script type="text/javascript" src="/sellsec/js/jquery.min.js"></script>
    <!-- bootstrap -->
    <link rel="stylesheet" type="text/css" href="/sellsec/bootstrap/css/bootstrap.min.css" />
    <script type="text/javascript" src="/sellsec/bootstrap/js/bootstrap.min.js"></script>
    <!-- jquery-validator -->
    <script type="text/javascript" src="/sellsec/jquery-validation/jquery.validate.min.js"></script>
    <script type="text/javascript" src="/sellsec/jquery-validation/localization/messages_zh.min.js"></script>
    <!-- layer -->
    <script type="text/javascript" src="/sellsec/layer/layer.js"></script>
    <!-- md5.js -->
    <script type="text/javascript" src="/sellsec/js/md5.min.js"></script>
    <!-- common.js -->
    <script type="text/javascript" src="/sellsec/js/common.js"></script>
</head>
<body>
<div class="panel panel-default">
  <div class="panel-heading">秒杀订单详情</div>
  <table class="table" id="goodslist">
        <tr>  
        <td>商品名称</td>  
        <td id="goodsName" colspan="3"></td>
     </tr>  
     <tr>  
        <td>商品图片</td>  
        <td colspan="2"><img id="goodsImg"  width="265" height="200" /></td>
     </tr>
      <tr>  
        <td>订单价格</td>  
        <td colspan="2" id="goodsPrice"></td>
     </tr>
     <tr>
     		<td>下单时间</td>  
        	<td id="createDate" colspan="2"></td>
     </tr>
     <tr>
     	<td>订单状态</td>  
        <td id="orderStatus">
        	<!--<span th:if="${orderInfo.status eq 0}">未支付</span>-->
        	<!--<span th:if="${orderInfo.status eq 1}">待发货</span>-->
        	<!--<span th:if="${orderInfo.status eq 2}">已发货</span>-->
        	<!--<span th:if="${orderInfo.status eq 3}">已收货</span>-->
        	<!--<span th:if="${orderInfo.status eq 4}">已退款</span>-->
        	<!--<span th:if="${orderInfo.status eq 5}">已完成</span>-->

        </td>  
        <td>
        	<button class="btn btn-primary btn-block" type="submit" id="payButton">立即支付</button>
        </td>
     </tr>
      <tr>
     		<td>收货人</td>  
        	<td colspan="2">XXX  18812341234</td>  
     </tr>
     <tr>
     		<td>收货地址</td>  
        	<td colspan="2">北京市昌平区回龙观龙博一区</td>  
     </tr>
  </table>
</div>

</body>
<script>

    $(function () {
        getOrderDetail();
    })
    function getOrderDetail() {
        var orderId = g_getQueryString("orderId");
        $.ajax({
            url:"/sellsec/order/detail/",
            type:"GET",
            data:{
                orderId:orderId
            },
            success:function (data) {
                if (data.code==0){
                    render(data.data);
                }else {
                    layer.msg(data.msg);
                }
            },
            error:function () {
                layer.msg("客户端请求错误");
            }
        });
    }

    function render(detail) {
        var goods = detail.goodsFormVO;
        var orderInfo = detail.orderInfo;
        $("#goodsName").text(goods.goodsName);
        $("#goodsImg").attr("src",goods.goodsImg);
        $("#goodsPrice").text(goods.goodsPrice);
        $("#createDate").text(new Date(orderInfo.createDate).format("yyyy-MM-dd hh:mm:ss"));
        var status = "";
        if (orderInfo.status==0){
            status="未支付";

        }else if(orderInfo.status==1){
            status="待发货";
        }
        $("#orderStatus").text(status);

    }
</script>
</html>
